package com.example.blog1.service;

import com.example.blog1.mapper.BlogInfoMapper;
import com.example.blog1.model.BlogInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BlogService {
    @Autowired
    private BlogInfoMapper blogInfoMapper;
    public List<BlogInfo> getBlogList() {
        return blogInfoMapper.getBlogList();
    }

    public Integer getUserIdByBlogId(Integer blogId) {
        return blogInfoMapper.queryUserIdByBlogId(blogId);
    }

    public BlogInfo queryBlogByBlogId(Integer blogId) {
        return blogInfoMapper.queryBlogByBlogId(blogId);
    }

    public Integer update(String title,String content,Integer id) {
        return blogInfoMapper.update(title,content,id);
    }

    public Integer add(BlogInfo blogInfo) {
        return blogInfoMapper.add(blogInfo);
    }

    public Integer delete(Integer blogId) {
        return blogInfoMapper.delete(blogId);
    }
}
